<?php
    /**
     * Export all member records in .xls format
     * with the help of the xlsHelper
     */

	//input the export file name
	$xls->setHeader('DSPhongTrao_'.date('Y_m_d'));

    $xls->addXmlHeader();
    $xls->setWorkSheetName('DSPhongTrao');

    //1st row for columns name
    $xls->openRow();
    $xls->writeString('Mã PT ');
    $xls->writeString('Tên PT');
    $xls->writeString('Đơn vị tổ chức');
    $xls->writeString('Ngày bắt đầu');
    $xls->writeString('Ngày kết thúc');
    $xls->writeString('Ghi chú');
    $xls->closeRow();

    //rows for data
    foreach ($events as $model):
    	$xls->openRow();
	    $xls->writeString($model['Event']['id']);
	    $xls->writeString($model['Event']['event']);
	    $xls->writeString($model['Union']['union_name']);
	    $xls->writeString($model['Event']['start_date']);
	    $xls->writeString($model['Event']['end_date']);
	    $xls->writeString($model['Event']['note']);
	    $xls->closeRow();
    endforeach;

    $xls->addXmlFooter();
    exit();
?>
